package com.online.fund.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class StringTest {

	public static void main(String[] args) {
		String content = "基金规模：0.50亿元（2017-12-31）";
		Pattern pattern = Pattern.compile("-*\\d+(\\.\\d+)?");
		Matcher matcher = pattern.matcher(content);
		if (matcher.find()) {
			System.out.println(matcher.group(0));
		}
		
		pattern = Pattern.compile("\\d{4}\\-\\d{1,2}-\\d{1,2}");
		matcher = pattern.matcher(content);
		if (matcher.find()) {
			System.out.println(matcher.group(0));
		}
		
		String test = "基金类型：联接基金  |  高风险";
		System.out.println(test.substring(test.indexOf("|  ") + "|  ".length()));
		
		
		String pjHtml = "<td><a class=\"floatleft\" href=\"http://fund.eastmoney.com/f10/jjpj_160610.html\">基金评级</a><span class=\"floatleft\">：</span>\r\n" + 
				" <div class=\"jjpj2\"></div></td>";
		
		Document doc = Jsoup.parse(pjHtml);
		System.out.println(doc.select("div").first().className());
		pattern = Pattern.compile("\\d");
		matcher = pattern.matcher("jjpj2");
		if (matcher.find()) {
			System.out.println(matcher.group(0));
		}
	}

}
